package ctn.dao.inteface;

import java.util.Date;
import java.util.List;
import java.util.Map;

import ctn.hibernate.po.CpaFun;
import ctn.service.dto.FunDTO;
import ctn.util.jmesa.PaginationCriteria;

public interface CPAFunDao {

	/**
	 * search the fun list by the project and the status, date
	 * @param cpaId
	 * @param status
	 * @param date
	 * @return
	 */
	List<Map<String, Object>> listFunInfoWithDoingStatus(Long cpaId,String status,Date date,Long userId);
	
	/**
	 * update the status and project to recover the status
	 * @param cpa
	 * @param user
	 * @return
	 */
	boolean recoverStatus(final Long cpa,final String status);
	
	/**
	 * through the primary key to update the properties
	 * @param properties
	 * @param values
	 * @param id
	 * @return
	 */
	boolean updateFunctionById(final String[] properties,final Object[] values,final long id);
	
	/**
	 * through the implement user id and project id to update the properties
	 * @param properties
	 * @param values
	 * @param id
	 * @return
	 */
	boolean updateFunctionByUserId(final String[] properties,final Object[] values,final long id,final long cpa,final String status);
	
	/**
	 * search the fun list by the project,status
	 * @param cpaId
	 * @param status
	 * @return
	 */
	List<Map<String, Object>> listFunInfoWithMovedStatus(final Long cpaId, final String status,final Long userId);

	/**
	 * search the fun list by the project,status
	 * @param cpaId
	 * @param status
	 * @return
	 */
	List<Map<String, Object>> listFunInfoWithCompleteStatus(final Long cpaId, final String status,final Long userId);
	
	
	/**
	 * through the project status and date to find the function mapping implement user
	 * @param cpaId
	 * @param status
	 * @param date
	 * @return
	 */
	List<Map<String, Object>> getFunImplUserId(final Long cpaId,final String status,final Date date);
	
	public Long getplugListCountByCriteria(PaginationCriteria criteria);
	
	public List<FunDTO> getWfunListByCriteria(PaginationCriteria criteria);
	
	public void saveFun(CpaFun fun);
	
	public void editFun(CpaFun fun);
	
	public final static String FUN_KEY_IMPL_USER_ID = "impl_user_id";
    public final static String FUN_KEY_PED = "ped";
    public final static String FUN_KEY_FUN_NAME = "funname";
    public final static String FUN_KEY_LEVEL = "level";
    public final static String FUN_KEY_IMPLUSER = "impluser";
    public final static String FUN_KEY_STATUS = "status";
    public final static String FUN_KEY_STAGE = "stage";
    public final static String FUN_KEY_FID = "fid";
    public final static String FUN_KEY_P_S_DIFF = "p_s_diff";
    public final static String FUN_KEY_N_P_DIFF = "n_p_diff";
    public final static String FUN_KEY_C_P_DIFF = "c_p_diff";
	CpaFun getCpaFunByID(Long id);


	FunDTO getFunDTOByID(Long id);
	
}
